package main

import "fmt"

type Pay interface {
	DoPay(price int64) string
}

type AliPay struct{}

type WechatPay struct{}

func (m *AliPay) DoPay(price int64) string {
	return "支付宝支付"
}

func (m *WechatPay) DoPay(price int64) string {
	return "微信支付"
}

type Refund interface {
	DoRefund(orderNo string) string
}

type AliRefund struct{}

type WechatRefund struct{}

func (m *AliRefund) DoRefund(orderNo string) string {
	return "支付宝退款"
}

func (m *WechatRefund) DoRefund(orderNo string) string {
	return "微信退款"
}

type PayFactory interface {
	CreatePay() Pay
	CreateRefund() Refund
}

type AliPayFactory struct{}

type WechatPayFactory struct{}

func (m *AliPayFactory) CreatePay() Pay {
	return &AliPay{}
}

func (m *AliPayFactory) CreateRefund() Refund {
	return &AliRefund{}
}

func (m *WechatPayFactory) CreatePay() Pay {
	return &WechatPay{}
}

func (m *WechatPayFactory) CreateRefund() Refund {
	return &WechatRefund{}
}

func main() {
	aliPayFactory := &AliPayFactory{}
	pay := aliPayFactory.CreatePay()
	fmt.Println(pay.DoPay(100))
	refund := aliPayFactory.CreateRefund()
	fmt.Println(refund.DoRefund("100"))

	wechatPayFacotry := &WechatPayFactory{}
	pay = wechatPayFacotry.CreatePay()
	fmt.Println(pay.DoPay(200))
	refund = wechatPayFacotry.CreateRefund()
	fmt.Println(refund.DoRefund("200"))
}
